package cn.le.helloWorld;

import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 项目名  spring-boot
 * Created by lansp
 * Created at 2018/5/31
 * 描述: rabbitMq配置来,用来配置队列,交换器,路由等高级信息
 */
@Configuration
public class RabbitConfig {

	//配置队列
	@Bean
	public Queue helloQueue(){
		return new Queue("hello");
	}

	//配置连接工厂
	/*@Bean
	public ConnectionFactory connectionFactory(){
		CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory(mqRabbitHost,mqRabbitPort);
		cachingConnectionFactory.setUsername(mqRabbitUserName);
		cachingConnectionFactory.setPassword(mqRabbitPassword);
		cachingConnectionFactory.setVirtualHost(mqRabbitVirtualHost);
		cachingConnectionFactory.setPublisherConfirms(true);
		return  cachingConnectionFactory;
	}*/

	/*@Bean
	public RabbitTemplate rabbitTemplate() {
		RabbitTemplate template = new RabbitTemplate(connectionFactory());
		return template;
	}*/

	//配置交换机
	/*@Bean
	public DirectExchange defaultExchange() {
		return new DirectExchange("spring-boot");
	}*/

	//将DirectExchange于queue进行绑定
	/*@Bean
	public Binding binding() {
		return BindingBuilder.bind(helloQueue()).to(defaultExchange()).with("routing_key");
	}*/

}

